//
//  TripTblCell.m
//  RoadLine
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 RedFireNoodles. All rights reserved.
//
//KennethWang 途行日记 界面的自定义cell;
#import "TripTblCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation TripTblCell
//自定义cell;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.tripTblView = [[UIView alloc]init];
        self.tripTblView.layer.cornerRadius = 8;
        self.tripTblView.clipsToBounds = YES;
        self.tripTblView.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:self.tripTblView];
        [_tripTblView release];
        
        self.tripTblImageView = [[UIImageView alloc]init];
        self.tripTblImageView.contentMode = UIViewContentModeScaleAspectFill;
        self.tripTblImageView.autoresizesSubviews = YES;
        self.tripTblImageView.clipsToBounds = YES;
        self.tripTblImageView.layer.cornerRadius = 8;
        self.tripTblImageView.clipsToBounds = YES;
        self.tripTblImageView.backgroundColor = [UIColor lightGrayColor];
        [self.tripTblView addSubview:self.tripTblImageView];
        [_tripTblImageView release];
        
        self.tripTblLabelView = [[UILabel alloc]init];
        self.tripTblLabelView.backgroundColor = [UIColor whiteColor];
        self.tripTblLabelView.alpha = 0.6;
        [self.tripTblView addSubview:self.tripTblLabelView];
        [_tripTblLabelView release];
        
        self.tripTblLabel = [[UILabel alloc]init];
        self.tripTblLabel.backgroundColor = [UIColor clearColor];
        self.tripTblLabel.numberOfLines = 5;
        [self.tripTblLabel sizeToFit];
        self.tripTblLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
        [self.tripTblView addSubview:self.tripTblLabel];
        [_tripTblLabel release];
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
//    if(self.tripTblImageView == nil){
//        
//    }
    self.tripTblImageView.frame = CGRectMake(3, 3, WIDTH-30, HEIGHT-5);
    self.tripTblLabel.frame = CGRectMake(7, HEIGHT*2/3, WIDTH-35, HEIGHT/3-15);
    self.tripTblView.frame = CGRectMake(13, 12, WIDTH-23, HEIGHT-10);
    self.tripTblLabelView.frame = CGRectMake(3, HEIGHT*2/3, WIDTH-30, HEIGHT/3-15);
    
    if ([Singleton shareSingleton].isNight) {
        [[Singleton shareSingleton] loadNightModeInfoFormDisk];
    }
}

- (void)setLightDayModel {
    self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
}

- (void)setNightDayModel {
    self.contentView.backgroundColor = [UIColor blackColor];
}

- (void)dealloc
{
    [_tripTblImageView release];
    [_tripTblLabel release];
    [_tripTblView release];
    [_tripTblLabelView release];
    [super dealloc];
}

@end
